﻿<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
>
  <xsl:template match="/">
    <html>
      <head>
        <link href="../Style/site.css" rel="stylesheet" type="text/css" />
      </head>
      <body>
        <h2>My TestDemo</h2>
        <xsl:apply-templates/>
      </body>
    </html>
  </xsl:template>

  <xsl:template match="catalog/cd">
    <p>
      <xsl:apply-templates select="title"/>
      <xsl:apply-templates select="artist"/>
      <xsl:apply-templates select="price"/>
    </p>
  </xsl:template>

  <xsl:template match="title">
    Title: <span style="color:#ff0000">
      <xsl:choose>
        <xsl:when test="1=1">
          <xsl:value-of select="."/>
        </xsl:when>
      </xsl:choose>
    </span>
    <br />
  </xsl:template>

  <xsl:template match="artist">
    Artist: <span style="color:#00ff00">
      <xsl:value-of select="."/>
    </span>
    <br />
  </xsl:template>

  <xsl:template match="price">
    Price: <span style="color:black">
      <xsl:choose>
        <xsl:when test=".>10">
          <span style="color:yellow">
            <xsl:value-of select="."/>
          </span>
        </xsl:when>
        <xsl:otherwise>
          <span style="color:green">
            价格小于10
          </span>
        </xsl:otherwise>
      </xsl:choose>

    </span>
    <br />
  </xsl:template>
</xsl:stylesheet>
